<template>
	<view class="carNum" :class="vehicleFlag ==  0?'red':''">
		<view>
			<text>{{first}}</text>
		</view>
		<text class="carNumber">{{other}}</text>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		props: {
			plate: {
				type: String,
				required: true
			},
			vehicleFlag :{
				type: Number,
				require: 1
			}
		},
		computed: {
			first() {
				return this.plate.substr(0, 1)
			},
			other() {
				return this.plate.substr(1)
			}
		}
	}
</script>

<style scoped lang="scss">
	.carNum {
		background: #FFFFFF;
		display: flex;
		align-items: center;
		line-height: 38rpx;
		border: 2rpx solid #003E81;
		view {
			width: 40rpx;
			height: 40rpx;
			background: #003E81;
			// border-radius: 4rpx 0 0 4rpx;
			text-align: center;
			margin-right: 0;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		text {
			font-size: 24rpx;
		}

		.carNumber {
			padding: 0 12rpx;
			color: #003E81;
		}
	}
	.red{
		border: 2rpx solid #F04848;
		background: #FFFFFF;
		view {
			background: #F04848;
		}
		.carNumber {
			color: #F04848;
		}
	}
</style>
